﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace IBuy.Entity
{
    public class ChartHelp
    {
        #region 私有变量
        private Product goods;
        private Hashtable table;
        private string[] names;
        private double[] values;
        private string ColName;
        #endregion
        #region 公有属性
        public string[] Names
        {
            get { return names; }
            set { names = value; }
        }
        public double[] Values
        {
            get { return values; }
            set { values = value; }
        }
        #endregion
        public ChartHelp(string colName)
        {
            goods = new Product();
            ColName = colName;
        }
        public void GetNamesAndValues()
        {
            table = goods.GetAllGoods(ColName);
            names = new string[table.Count];
            values = new double[table.Count];
            int i=0;
            foreach (DictionaryEntry item in table)
            {
                names[i] = item.Key.ToString();
                values[i] = double.Parse(item.Value.ToString());
                i++;
            }
        }
    }
}
